package com.xbb.controller;

import java.util.List;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xbb.entity.Ecarts;
import com.xbb.entity.dto.StatisticDto;
import com.xbb.service.StatisticService;
import com.xbb.util.Result;

@RestController
public class StatisticController {

	@Autowired
	StatisticService statisticService;

	
	@RequestMapping("/getStatistic")
	public Object getStatistic(String beginTime,String endTime) {
		List<Integer> peopleNum = statisticService.getPeopleNum(beginTime,endTime);
		List<String> readroomName = statisticService.getReadroomName(beginTime,endTime);
		Ecarts ecarts = new Ecarts();
		ecarts.setxData(readroomName);
		ecarts.setyData(peopleNum);
		return ecarts;
		
	}

	
	@RequestMapping("/getStaInfos")
	public Object getStaInfos(StatisticDto statisticDto, ModelMap map) {
		List<StatisticDto> list = statisticService.getStaInfo(statisticDto);
		statisticDto.setLimit(null);
		statisticDto.setPage(null);
		List<StatisticDto> list2 = statisticService.getStaInfo(statisticDto);
		return new Result(0, "", list2.size(), list);
		
	}

}
